<?php

namespace App\Http\Service;

use App\Libs\HttpCurlLibrary;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Log;
use App\Models\Forbiddenwords;
use App\Models\Forbiddenwordslog;
use App\Http\Service\BaseService;

//关键词记录
class ForbiddenwordslogService extends BaseService
{
   
    public $forbiddenwords;
    public $imagecheck;
    public $contentcheck;
    public function __construct(Forbiddenwordslog $model,Forbiddenwords $forbiddenwords)
    {
        parent::__construct();
        $this->imagecheck=config('myurl.imagecheck.url');
        $this->contentcheck=config('myurl.contentcheck.url');
        $this->model=$model;
        $this->forbiddenwords=$forbiddenwords;
    }

    #添加
    public function addData($data)
    {
        $where=['found_words'=>$data['found_words']];
        $first=$this->model->where($where)->first();
        if($first){
            $data['update_time']=date("Y-m-d h:i:s");
            $this->model->where($where)->update($data);

        }else{
            $data['create_time']=date("Y-m-d h:i:s");
            $data['update_time']=date("Y-m-d h:i:s");
            $this->model->where($where)->insertGetId($data);
        }

    }

   
    

}
